﻿using SlamDunk.CMS.Model.Base;
using SlamDunk.CMS.Model.ViewModel;

namespace SlamDunk.CMS.Model.DataModel
{
    /// <summary>
    /// 链接类别
    /// </summary>
    public class LinkCategory : BaseEntity
    {
        #region # 属性

        #region 类别名称 —— string CategoryName
        /// <summary>
        /// 类别名称
        /// </summary>
        public string CategoryName { get; set; }
        #endregion

        #region 排序 —— int Sort
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }
        #endregion

        #endregion

        #region # 方法

        #region 转换为视图模型 —— LinkCategoryView ToViewModel()
        /// <summary>
        /// 转换为视图模型
        /// </summary>
        /// <returns>视图模型</returns>
        public LinkCategoryView ToViewModel()
        {
            return new LinkCategoryView()
            {
                Id = this.Id,
                CategoryName = this.CategoryName,
                Sort = this.Sort,
                AddTime = this.AddTime.ToString("yyyy-MM-dd HH:mm:ss")
            };
        }
        #endregion

        #endregion
    }
}
